package com.sunlands.qdcy.tongzhuo.constant;


public class RedisKeyConst {

    private static final String HEAD = "tz-user-diary";

    /**
     * redis中间前缀
     */
    private static final String REDIS_SPLIT_PRE = ":";
    /**
     * redis中间后缀
     */
    private static final String REDIS_SPLIT_SUFFIX = "_";


    /**
     * 获取redis的key
     *
     * @param pre
     * @param argArray
     * @return
     */
    private static String getKeyArray(String pre, Object[] argArray) {
        if (argArray != null && argArray.length != 0) {
            StringBuffer sb = new StringBuffer();
            sb.append(HEAD);
            sb.append(REDIS_SPLIT_PRE);
            sb.append(pre);
            int start = 0;
            for (int i = 0; i < argArray.length; i++) {
                if (argArray[i] == null) {
                    continue;
                }
                if (start == 0) {
                    sb.append(REDIS_SPLIT_PRE);
                } else {
                    sb.append(REDIS_SPLIT_SUFFIX);
                }
                sb.append(argArray[i]);
                start++;
            }
            return sb.toString();
        }
        return HEAD + REDIS_SPLIT_PRE + pre;
    }

    /**
     * 单个日记
     */
    private static final String USER_DIARY_ONE = "one";

    public static String getUserDiaryOne(Object... objects) {
        return getKeyArray(USER_DIARY_ONE, objects);
    }

    /**
     * 我的日记列表
     */
    private static final String USER_DIARYLIST = "list";

    public static String getUserDiarylist(Object... objects) {
        return getKeyArray(USER_DIARYLIST, objects);
    }

    /**
     * 日记评论列表
     */
    private static final String USER_DIARY_COMMENT_LIST = "comment:list";

    public static String getUserDiaryCommentList(Object... objects) {
        return getKeyArray(USER_DIARY_COMMENT_LIST, objects);
    }

    /**
     * 日记回复数量
     */
    private static final String USER_DIARY_COMMENT_COUNT = "diary:count";

    public static String getUserDiaryCommentCount(Object... objects) {
        return getKeyArray(USER_DIARY_COMMENT_COUNT, objects);
    }

    /**
     * 评论回复数量
     */
    private static final String USER_COMMENT_REPLY_COUNT = "reply:count";

    public static String getUserCommentReplyCount(Object... objects) {
        return getKeyArray(USER_COMMENT_REPLY_COUNT, objects);
    }

    /**
     * 单个回复
     */
    private static final String USER_DIARY_REPLY = "reply";

    public static String getUserDiaryReply(Object... objects) {
        return getKeyArray(USER_DIARY_REPLY, objects);
    }

    /**
     * 取消点赞次数
     */
    private static final String CANCEL_ZAN_COUNT = "cacelZanCount";

    public static String getCancelZanCount(Object... objects) {
        return getKeyArray(CANCEL_ZAN_COUNT, objects);
    }

    /**
     * 日记是否被点赞
     */
    private static final String TARGET_TYPE_ZAN_BY_USERID = "target:type:zan:by-userId";

    public static String getTargetTypeZanByUserid(Object... objects) {
        return getKeyArray(TARGET_TYPE_ZAN_BY_USERID, objects);
    }

    /**
     * 日记点赞列表
     */
    private static final String USER_DIARY_ZAN_LIST = "zan:list";

    public static String getUserDiaryZanList(Object... objects) {
        return getKeyArray(USER_DIARY_ZAN_LIST, objects);
    }

    /**
     * 日记点赞数量
     */
    private static final String USER_DIARY_ZAN_COUNT = "zan:count";

    public static String getUserDiaryZanCount(Object... objects) {
        return getKeyArray(USER_DIARY_ZAN_COUNT, objects);
    }

    /**
     * 日记转发列表
     */
    private static final String USER_DIARY_FORWARD_LIST = "forward:list";

    public static String getUserDiaryForwardList(Object... objects) {
        return getKeyArray(USER_DIARY_FORWARD_LIST, objects);
    }

    /**
     * 日记转发数量
     */
    private static final String USER_DIARY_FORWARD_COUNT = "forward:count";

    public static String getUserDiaryForwardCount(Object... objects) {
        return getKeyArray(USER_DIARY_FORWARD_COUNT, objects);
    }

    private static final String USER_DIARY_FORWARD_MESSAGE_LIST = "forward:msg:list";

    public static String getUserDiaryForwardMessageList(Object... objects) {
        return getKeyArray(USER_DIARY_FORWARD_MESSAGE_LIST, objects);
    }

    private static final String REPLY_LOCK = "reply_lock";

    public static String getReplyLock(Object... objects) {
        return getKeyArray(REPLY_LOCK, objects);
    }
}
